/*
 *
 *  *  Copyright © 2020 CIB Co.Ltd
 *  *  * All right reserved
 *  *  * Auther:7ason
 *  *
 *
 */

package com.wsd.web;

import com.wsd.common.Result;
import com.wsd.constant.ResultCode;
import com.wsd.service.AdminService;
import com.wsd.service.WechatService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;


@Controller
public class WechatController {

    @Autowired
    private WechatService wechatServer;

    @RequestMapping(value = "/quickLoan/wxCode2Session",method = RequestMethod.GET)
    @ResponseBody
    public Result wxCode2Session(String js_code){
        Result result = null;
        //检查参数
        if(StringUtils.isEmpty(js_code)){
            result = new Result();
            result.setResultCode(ResultCode.PARAM_IS_BLANK);
            return result;
        }

        result = wechatServer.jscodeToWeixinSession(js_code);

        return result;
    }



    @RequestMapping(value = "/quickLoan/testMessage",method = RequestMethod.GET)
    @ResponseBody
    public Result testMessage(String openid){
        Result result = null;
        //检查参数
        if(StringUtils.isEmpty(openid)){
            result = new Result();
            result.setResultCode(ResultCode.PARAM_IS_BLANK);
            return result;
        }

        return result;
    }

}